﻿using UnityEngine;
using System.Collections;

public class Throw : MonoBehaviour
{
    public Vector2 m_vecDest;
    public string m_strTargettag = "Player";
    public float m_fSpeed = 0.0f;
    private float m_fCurrentSpeed = 0.0f;

    public bool m_bHitFlag = false;

    

    public GameObject m_pBloodSpread;

    void Update()
    {
        if (m_fCurrentSpeed < m_fSpeed)
            m_fCurrentSpeed += (m_fSpeed/2 + Time.deltaTime * 10.0f);

        Calculate.MoveToDest(gameObject, m_vecDest, m_fCurrentSpeed);
    }

    void OnTriggerStay2D(Collider2D coll)
    {
        if (m_bHitFlag == false)
            return;

        if (m_strTargettag == coll.gameObject.tag)
        {
            coll.gameObject.GetComponent<UnitStatus>().m_unitData.iUnitStatus = (int)BASEUNIT_STATE.KNOCKBACK;

            //Instantiate(ResourceMgr.GetInstance().GetBloodMark(), transform.position, transform.rotation);

            //coll.GetComponent<UnitStatus>().m_unitData.iCurrentHP -= 10;
            //Destroy(gameObject);
        }

    }


}

